home *** CD-ROM | disk | FTP | other *** search
- 100 'Simple Investments ("SIMPINV")
- 110 CLS
- 120 COLOR 0,15 : PRINT "Simple Investments Evaluator" : COLOR 15,0
- 130 DEFDBL A-Z
- 140 DEFINT M-N
- 150 'Define rounding function
- 160 DEF FNR (V) = SGN (V) * INT (ABS (V) * 100 + .5) / 100
- 170 MONEYFMT$ = "$$##,###,###.##"
- 180 ' Let user select result
- 190 PRINT
- 200 PRINT "Select desired result:"
- 210 PRINT
- 220 PRINT "1 - Current Value"
- 230 PRINT "2 - Rate of Return"
- 240 PRINT "3 - Future Value"
- 250 PRINT
- 260 INPUT "Result number: ", RESULT
- 270 IF RESULT < 1 OR RESULT > 3 THEN PRINT "Select 1-3 only" : GOTO 210
- 280 PRINT
- 290 ' Let user enter data
- 300 PRINT "Do not enter dollar signs or commas"
- 310 PRINT
- 320 IF RESULT <> 1 THEN INPUT "Purchase price: ", PV
- 330 IF RESULT <> 2 THEN INPUT "Annual rate of return (in percent): ", AR
- 340 IF RESULT <> 3 THEN INPUT "Value at end of term: ", FV
- 350 INPUT "Number of periods: ", NPERIODS
- 360 INPUT "Number of periods per year: ", NPY
- 370 ' Compute periodic interest rate
- 380 PR = (1 + AR / 100) ^ (1 / NPY) - 1
- 390 ON RESULT GOTO 410,460,520
- 400 ' Result 1: Find current value
- 410 PV = FV * (1 + PR) ^ -NPERIODS
- 420 PRINT
- 430 PRINT "Current Value: "; USING MONEYFMT$; PV
- 440 END
- 450 ' Result 2: Find rate of return
- 460 PR = (FV / PV) ^ (1 / NPERIODS) - 1
- 470 AR = ((1 + PR) ^ NPY - 1) * 100
- 480 PRINT
- 490 PRINT "Annual rate of return: "; FNR(AR);"%"
- 500 END
- 510 ' Result 3: Find future value of investment
- 520 FV = PV * (1 + PR) ^ NPERIODS
- 530 PRINT
- 540 PRINT "Future value: "; USING MONEYFMT$; FV
- 550 END